﻿

using com.iot.core.infrastructure;
using com.iot.core.manager.htcls;
using com.iot.core.manager.htctl;
using com.iot.core.manager.id;
using Microsoft.AspNetCore.Builder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace com.iot.core.boot
{
    public static class ApplicationBuilderExtensions
    {
        public static void ConfigureRequestPipeline(this WebApplication application)
        {
            application.UseMiddleware<IotFirstMiddleware>();

            application.MapControllers();

            EngineContext.Current.ConfigureRequestPipeline(application);

          

        }

        public static async Task StartEngineAsync(this WebApplication application)
        {
            var engine = EngineContext.Current;
            await HtIdManager.Current.StartAsnyc();
            await HtClsManager.Current.StartAsnyc();
            await HtCtlManager.Current.StartAsnyc();

            //further actions are performed only when the database is installed

        }


    }
}
